import { EntityBase } from 'ibiz-core';
import { ICHARTENTITY } from '../interface';

/**
 * 图表实体基类
 *
 * @export
 * @abstract
 * @class CHARTENTITYBase
 * @extends {EntityBase}
 * @implements {ICHARTENTITY}
 */
export abstract class CHARTENTITYBase extends EntityBase implements ICHARTENTITY {
    /**
     * 实体名称
     *
     * @readonly
     * @type {string}
     * @memberof CHARTENTITYBase
     */
    get srfdename(): string {
        return 'CHARTENTITY';
    }
    get srfkey() {
        return this.chartentityid;
    }
    set srfkey(val: any) {
        this.chartentityid = val;
    }
    get srfmajortext() {
        return this.chartentityname;
    }
    set srfmajortext(val: any) {
        this.chartentityname = val;
    }
    /**
     * 图表实体名称
     */
    chartentityname?: any;
    /**
     * 图表实体标识
     */
    chartentityid?: any;
    /**
     * 建立时间
     */
    createdate?: any;
    /**
     * 更新时间
     */
    updatedate?: any;
    /**
     * 建立人
     */
    createman?: any;
    /**
     * 更新人
     */
    updateman?: any;
    /**
     * 数值
     */
    fielddata?: any;
    /**
     * 数值2
     */
    fielddata2?: any;
    /**
     * 分类
     */
    category?: any;
    /**
     * 分类1
     *
     * @type {('100' | '200' | '300' | '400')} 100: 衣服, 200: 鞋子, 300: 电脑, 400: 文具
     */
    categoryone?: '100' | '200' | '300' | '400';
    /**
     * 属性
     *
     * @type {('10' | '20' | '30' | '40')} 10: 未提交, 20: 流程中, 30: 完成, 40: 取消
     */
    valuestate?: '10' | '20' | '30' | '40';
    /**
     * 图表序列标识
     */
    valuestateid?: any;
    /**
     * 图表序列名称
     */
    valuestatename?: any;

    /**
     * 重置实体数据
     *
     * @private
     * @param {*} [data={}]
     * @memberof CHARTENTITYBase
     */
    reset(data: any = {}): void {
        super.reset(data);
        this.chartentityid = data.chartentityid || data.srfkey;
        this.chartentityname = data.chartentityname || data.srfmajortext;
    }
}
